<?php
/**
 * User: Tony Chen
 * Date: 2017/7/23.
 */

define('ROOT_PATH', $_SERVER['DOCUMENT_ROOT']);
include ROOT_PATH . '/utils/Mysql.php';
include ROOT_PATH . '/utils/Session.php';

/**
 * 创建session对象
 * @return Session
 */
function newSession()
{
    return new Session();
}

/**
 * 获取指定key的session值
 * @param $key
 *
 * @return session
 */
function sessionGet($key)
{
    return newSession()->get($key);
}

/**
 * 设置为key设置value值
 * @param $key
 * @param $value
 */
function sessionSet($key, $value)
{
    newSession()->set($key, $value);
}

/**
 * 删除指定key的session值
 * @param $key
 */
function sessionDel($key)
{
    newSession()->delete($key);
}

/**
 * 清空全部session
 */
function sessionClear()
{
    newSession()->clear();
}

function newMysql()
{
    return new Mysql('127.0.0.1', 'root', '123456', 'cms');
}








